Assignemnt #38 and Thirty-fifth Program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: Thirty-fifth Program
///File name: ThirfiProg.java
///Date Finished:10/5/2015
import java.util.Scanner;
public class ThirfiProg
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int planet;
double weight;
System.out.print( "Please enter your current earth weight: " );
weight = keyboard.nextDouble();
System.out.println( "I have information for the following planets" );
System.out.println( " 1. Venus 2. Mars 3. Jupiter" );
System.out.println( " 4. Saturn 5. Uranus 6.Neptune" );
System.out.print( "Which planet are you visiting? " );
planet = keyboard.nextInt();
if(planet == 1)
{
weight = weight * .78;
System.out.println( "Your weight would be " + weight + " pounds on that planet." );
}
if(planet == 2)
{
weight = weight * .39;
System.out.println( "Your weight would be " + weight + " pounds on that planet." );
}
if(planet == 3)
{
weight = weight * 2.65;
System.out.println( "Your weight would be " + weight + " pounds on that planet." );
}
if(planet == 4)
{
weight = weight * 1.17;
System.out.println( "Your weight would be " + weight + " pounds on that planet." );
}
if(planet == 5)
{
weight = weight * 1.05;
System.out.println( "Your weight would be " + weight + " pounds on that planet." );
}
if(planet == 6)
{
weight = weight * 1.23;
System.out.println( "Your weight would be " + weight + " pounds on that planet." );
}
}
}
Picture of the output